home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6948 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  709 b 

  1. Path: god.bel.alcatel.be!btmpj7!ian
  2. From: ian@rsd.bel.alcatel.be (Ian Ward)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Tough FACTORIAL math problem...
  5. Date: 16 Feb 1996 16:17:47 GMT
  6. Organization: Alcatel Bell Telephone
  7. Distribution: world
  8. Message-ID: <4g2anb$gre@btmpjg.god.bel.alcatel.be>
  9. References: <4g285r$gre@btmpjg.god.bel.alcatel.be>
  10. Reply-To: ian@rsd.bel.alcatel.be
  11. NNTP-Posting-Host: btmpj7.rsd.bel.alcatel.be
  12.  
  13.  
  14. Or you could try...
  15.  
  16. int last_digit2 (num)
  17. int num;
  18. {static int fred [] =
  19.    {1,1,2,6,4,2,2,4,2,8,8,8,
  20.     6,8,2,6,6,2,6,4,4,4,8,4,
  21.     6,8,8,6,8,2,2,2,4,2,8,4,
  22.     4,8,4,6,6,6,2,6,4,2,2,4,2,8};
  23. return fred[num>9?10+((num-10)%40):num];}
  24.  
  25.  
  26. ---
  27. Ian Ward's opinions only : ian@rsd.bel.alcatel.be
  28.  
  29.